﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KylinORM.Utils;

namespace KylinORM.CQRS.Publisher
{
    /// <summary>
    /// 定义在异常抛出后要执行的命令
    /// </summary>
    public class AfterThrowingEvent : AfterSubmitEvent
    {
        /// <summary>
        /// 创建 AfterThrowingEvent 的实例
        /// </summary>
        /// <param name="messageName">操作的类型</param>
        /// <param name="affectedRows">受操作影响的行数</param>
        protected internal AfterThrowingEvent(string messageName, int affectedRows)
            : base(messageName, affectedRows, null, null)
        {
        }
        /// <summary>
        /// 创建 AfterThrowingEvent 的实例
        /// </summary>
        /// <param name="messageName">操作的类型</param>
        /// <param name="affectedRows">受操作影响的行数</param>
        /// <param name="keys">主键/主键值</param>
        /// <param name="values">非主键/非主键值</param>
        protected internal AfterThrowingEvent(string messageName, int affectedRows, ReadonlyOrderedDictionary keys, ReadonlyOrderedDictionary values)
            : base(messageName, affectedRows, keys, values, null)
        {
        }
        /// <summary>
        /// 创建 AfterThrowingEvent 的实例
        /// </summary>
        /// <param name="messageName">操作的类型</param>
        /// <param name="affectedRows">受操作影响的行数</param>
        /// <param name="keys">主键/主键值</param>
        /// <param name="values">非主键/非主键值</param>
        /// <param name="exception">获取更新操作过程中引发的异常（如果有）</param>
        protected internal AfterThrowingEvent(string messageName, int affectedRows, ReadonlyOrderedDictionary keys, ReadonlyOrderedDictionary values,
            Exception exception)
            : base(messageName, affectedRows, keys, values, exception)
        {
        }
    }
}
